﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using sydfdl.TMS.BLL;
using sydfdl.TMS.Model;
using sydfdl.TMS.Tool;

namespace sydfdl.TMS.Areas.Finance.Controllers
{
    public class CashController : Controller
    {
        //
        // GET: /Finance/Cash/

        public ActionResult Index()
        {
            return View();
        }

        public void GetCash()
        {
            string xml = JsonHelp.GetParaXML(Request.Form.Get("pageIndex"), Request.Form.Get("pageSize"),
                Request.Form.Get("sortField"), Request.Form.Get("sortOrder"), Request.Form.Get("key"));
            //Response.Write(JsonHelp.EntitiesToString(new BLLT_F_Cash().GetList(xml)));
        }
        public void SaveCash()
        {
            string json = @"[]";
            IEnumerable<T_F_Cash> add = Request.Form.Get("add") == json ? null : JsonHelp.ConvertJsonToEntity<IEnumerable<T_F_Cash>>(Request.Form.Get("add"));
            IEnumerable<T_F_Cash> edit = Request.Form.Get("edit") == json ? null : JsonHelp.ConvertJsonToEntity<IEnumerable<T_F_Cash>>(Request.Form.Get("edit"));
            IEnumerable<T_F_Cash> del = Request.Form.Get("del") == json ? null : JsonHelp.ConvertJsonToEntity<IEnumerable<T_F_Cash>>(Request.Form.Get("del"));

            Response.Write(new BLLT_F_Cash().Save(add, edit, del));
        }
    }
}
